<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Function template indexed</title>
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Histogram">
<link rel="up" href="../../histogram/reference.html#header.boost.histogram.indexed_hpp" title="Header &lt;boost/histogram/indexed.hpp&gt;">
<link rel="prev" href="indexed_idm11941.html" title="Function template indexed">
<link rel="next" href="indexed_range.html" title="Class template indexed_range">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="indexed_idm11941.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../histogram/reference.html#header.boost.histogram.indexed_hpp"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="indexed_range.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="boost.histogram.indexed_idm11966"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Function template indexed</span></h2>
<p>boost::histogram::indexed — Generates and indexed range <a href="https://en.cppreference.com/w/cpp/named_req/ForwardIterator" target="_top">forward iterators</a> over a rectangular region of histogram cells.</p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../histogram/reference.html#header.boost.histogram.indexed_hpp" title="Header &lt;boost/histogram/indexed.hpp&gt;">boost/histogram/indexed.hpp</a>&gt;

</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Histogram<span class="special">,</span> <span class="keyword">typename</span> Iterable<span class="special">&gt;</span> 
  <span class="keyword">auto</span> <span class="identifier">indexed</span><span class="special">(</span><span class="identifier">Histogram</span> <span class="special">&amp;&amp;</span> hist<span class="special">,</span> <span class="identifier">Iterable</span> <span class="special">&amp;&amp;</span> range<span class="special">)</span><span class="special">;</span></pre></div>
<div class="refsect1">
<a name="idm14305"></a><h2>Description</h2>
<p>Use this in a range-based for loop. Example: </p>
<pre class="programlisting"><span class="keyword">auto</span> <span class="identifier">hist</span> <span class="special">=</span> <span class="identifier">make_histogram</span><span class="special">(</span><span class="identifier">axis</span><span class="special">::</span><span class="identifier">integer</span><span class="special">&lt;</span><span class="special">&gt;</span><span class="special">(</span><span class="number">0</span><span class="special">,</span> <span class="number">4</span><span class="special">)</span><span class="special">,</span> <span class="identifier">axis</span><span class="special">::</span><span class="identifier">integer</span><span class="special">&lt;</span><span class="special">&gt;</span><span class="special">(</span><span class="number">2</span><span class="special">,</span> <span class="number">6</span><span class="special">)</span><span class="special">)</span><span class="special">;</span>
<span class="identifier">axis</span><span class="special">::</span><span class="identifier">index_type</span> <span class="identifier">range</span><span class="special">[</span><span class="number">2</span><span class="special">]</span> <span class="special">=</span> <span class="special">{</span><span class="special">{</span><span class="number">1</span><span class="special">,</span> <span class="number">3</span><span class="special">}</span><span class="special">,</span> <span class="special">{</span><span class="number">0</span><span class="special">,</span> <span class="number">2</span><span class="special">}</span><span class="special">}</span><span class="special">;</span>
<span class="keyword">for</span> <span class="special">(</span><span class="keyword">auto</span><span class="special">&amp;&amp;</span> <span class="identifier">x</span> <span class="special">:</span> <span class="identifier">indexed</span><span class="special">(</span><span class="identifier">hist</span><span class="special">,</span> <span class="identifier">range</span><span class="special">)</span><span class="special">)</span> <span class="special">{</span> <span class="special">...</span> <span class="special">}</span>
</pre>
<p> This skips the first and last index of the first axis, and the last two indices of the second.</p>
<p>

</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><code class="computeroutput">hist</code></span></p></td>
<td><p>Reference to the histogram. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">range</code></span></p></td>
<td><p>Iterable over items with two axis::index_type values, which mark the begin and end index of each axis. The length of the iterable must be equal to the rank of the histogram. The begin index must be smaller than the end index. Index ranges wider than the actual range are reduced to the actual range including underflow and overflow indices. </p></td>
</tr>
</tbody>
</table></div></td>
</tr>
<tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p><a class="link" href="indexed_range.html" title="Class template indexed_range">indexed_range</a></p></td>
</tr>
</tbody>
</table></div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2016-2019 Hans
      Dembinski<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="indexed_idm11941.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../histogram/reference.html#header.boost.histogram.indexed_hpp"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="indexed_range.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
